package com.example.abe.diandi.trends.model;

import android.os.Parcel;
import android.os.Parcelable;

/**
 * Created by abe on 17/3/13.
 */

public class ImageTextModel implements Parcelable {
    private String image;
    private String content;
    private String id;

    //本地使用: 编辑多图动态时，判断位置。
    private int position;

    public String getContent() {
        return content;
    }

    public void setContent(String content) {
        this.content = content;
    }

    public String getImage() {
        return image;
    }

    public void setImage(String image) {
        this.image = image;
    }

    public int getPosition() {
        return position;
    }

    public String getId() {
        return id;
    }

    public void setId(String id) {
        this.id = id;
    }

    public void setPosition(int position) {
        this.position = position;
    }

    public void update(ImageTextModel model){
        this.image = model.getImage();
        this.content = model.getContent();
    }

    /**  序列化  **/

    @Override
    public int describeContents() {
        return 0;
    }

    @Override
    public void writeToParcel(Parcel dest, int flags) {
        dest.writeInt(this.position);
        dest.writeString(this.image);
        dest.writeString(this.content);
        dest.writeString(this.id);
    }

    public ImageTextModel() {
    }

    protected ImageTextModel(Parcel in) {
        this.position = in.readInt();
        this.image = in.readString();
        this.content = in.readString();
        this.id = in.readString();
    }

    public static final Creator<ImageTextModel> CREATOR = new Creator<ImageTextModel>() {
        @Override
        public ImageTextModel createFromParcel(Parcel source) {
            return new ImageTextModel(source);
        }

        @Override
        public ImageTextModel[] newArray(int size) {
            return new ImageTextModel[size];
        }
    };
}
